﻿Imports Microsoft.Reporting.WinForms
Public Class frmViewReport
    Private Sub frmViewReport_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.rvDefault.RefreshReport()
    End Sub

    Public Sub Initialize_rptMaster(ReportName As String, dsSource1 As DataSet)
        Dim rptDataSource As New ReportDataSource
        Dim rptCompany As New ReportDataSource
        rptCompany.Name = "dsCompany"
        rptCompany.Value = New dbSystem().GetCompanyProfile().Tables(0)
        Select Case ReportName
            Case "MasterStudent"
                rptDataSource.Name = "dsStudent"
                rptDataSource.Value = dsSource1.Tables(0)

                With rvDefault.LocalReport
                    .DataSources.Clear()
                    .DataSources.Add(rptDataSource)
                    .DataSources.Add(rptCompany)
                    .ReportEmbeddedResource = "famiglia_base.rptListStudent.rdlc"
                End With
        End Select
        Me.Show()
        Me.rvDefault.RefreshReport()
    End Sub
End Class